.PHONY: build pb wire

OUT_TARGET := /payme3000/go/api_gateway

build: pb
	mkdir -p /payme3000/go
	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags dynamic -o $(OUT_TARGET) .

pb:
	mkdir -p ../../pb
	rm -f ../../pb/*.go
	rm -f ../../pb/*.json
	protoc \
		--experimental_allow_proto3_optional \
		-I=../../pb \
		--go_out=../../pb \
		--go_opt=paths=source_relative \
		--go-grpc_out=../../pb \
		--go-grpc_opt=paths=source_relative \
		../../*.proto
	protoc-go-inject-tag -input="../../pb/*.pb.go"

wire:
	cd ./internal/app && wire && cd -
